EC-CUBE 2.11.4
[ class tree: EC-CUBE 2.11.4 ] [ index: EC-CUBE 2.11.4 ] [ all elements ]

Source for file LC_Upgrade_Helper_Json.php

Documentation is available at LC_Upgrade_Helper_Json.php

  1. <?php
  2. require_once CLASS_REALDIR '../module/Services/JSON.php';
  3. /**
  4.  * Enter description here...
  5.  *
  6.  */
  7. class LC_Upgrade_Helper_Json extends Services_JSON {
  8.     /** */
  9.     var $arrData = array(
  10.         'status'  => null,
  11.         'errcode' => null,
  12.         'msg'     => null,
  13.         'data'    => array()
  14.     );
  15.  
  16.     /**
  17.      * Enter description here...
  18.      *
  19.      * @return SC_Upgrade_Helper_Json 
  20.      */
  21.     function LC_Upgrade_Helper_Json({
  22.         parent::Services_JSON();
  23.     }
  24.  
  25.     /**
  26.      * Enter description here...
  27.      *
  28.      */
  29.     function isError({
  30.         return $this->isSuccess(false true;
  31.     }
  32.  
  33.     function isSuccess({
  34.         if ($this->arrData['status'=== OSTORE_STATUS_SUCCESS{
  35.             return true;
  36.         }
  37.         return false;
  38.     }
  39.  
  40.     /**
  41.      * Enter description here...
  42.      *
  43.      * @param unknown_type $errCode 
  44.      * @param unknown_type $errMessage 
  45.      */
  46.     function setError($errCode{
  47.         $masterData new SC_DB_MasterData();
  48.         $arrOStoreErrMsg $masterData->getMasterData("mtb_ownersstore_err");
  49.  
  50.         $this->arrData['status']  OSTORE_STATUS_ERROR;
  51.         $this->arrData['errcode'$errCode;
  52.         $this->arrData['msg']  = isset($arrOStoreErrMsg[$errCode])
  53.             ? $arrOStoreErrMsg[$errCode]
  54.             : $arrOStoreErrMsg[OSTORE_E_UNKNOWN];
  55.     }
  56.  
  57.     /**
  58.      * Enter description here...
  59.      *
  60.      * @param mixed $data 
  61.      */
  62.     function setSuccess($data array()$msg ''{
  63.         $this->arrData['status'OSTORE_STATUS_SUCCESS;
  64.         $this->arrData['data']   $data;
  65.         $this->arrData['msg']    $msg;
  66.     }
  67.  
  68.     /**
  69.      * Enter description here...
  70.      *
  71.      */
  72.     function display({
  73.         header("Content-Type: text/javascript; charset=UTF-8");
  74.         echo $this->encode($this->arrData);
  75.     }
  76.  
  77.     /**
  78.      * JSONデータをデコードする.
  79.      *
  80.      * php5.2.0からpreg_match関数に渡せるデータ長に制限がある(?)ため,
  81.      * Services_JSONが正常に動作しなくなる.
  82.      * そのため5.2.0以上の場合は組み込み関数のjson_decode()を使用する.
  83.      *
  84.      * @param string $str 
  85.      * @return StdClass 
  86.      * @see SC_Utils_Ex::jsonDecode
  87.      */
  88.     function decode($str{
  89.         return SC_Utils_Ex::jsonDecode($str);
  90.     }
  91. }

Documentation generated on Fri, 24 Feb 2012 14:02:23 +0900 by Seasoft